<%@ page contentType="text/html;charset=UTF-8" language="java" import="com.scalar.chiptrack.utils.ConfigManager,java.util.ArrayList,
                                                                       com.scalar.chiptrack.operations.processtypesetup.ProcessParameters,
                                                                       java.util.HashMap,
                                                                       com.scalar.chiptrack.commons.Constants"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/processTypeSetup.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> ScalarSoft - ChipTrac </TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script language=javascript src = "<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<script language="JavaScript">
<%	ArrayList unitsList = ( ArrayList )session.getAttribute( "units" );

	if( unitsList != null )
	{
	int length = unitsList.size();
%>
	var unitsArray = new Array( '<%=length%>' );

<%	for( int i = 0; i < length; i++ )
	{
		com.scalar.chiptrack.commons.UOM units = (com.scalar.chiptrack.commons.UOM)unitsList.get( i );
%>
		var uom		 = '<%=units.getUom()%>';
		var baseUOM  = '<%=units.getBaseUom()%>';
		var minValue = '<%=units.getMinValue()%>';
		var maxValue = '<%=units.getMaxValue()%>';
		var units  = new Array( uom, baseUOM, minValue, maxValue );
		unitsArray[ <%=i%> ] = units;
<%
	}
	}

	com.scalar.chiptrack.operations.processtypesetup.forms.ProcessTypeSetupForm processTypeForm = (com.scalar.chiptrack.operations.processtypesetup.forms.ProcessTypeSetupForm)session.getAttribute( "processTypeSetupForm" );

	String actionVal = processTypeForm.getAction();
%>

	<% int rowcount = 0; %>

	function submit()
	{
		if( validations() == true )
		{
			if( document.processTypeSetupForm.processTypeId.value == '-1' )
			{
				document.processTypeSetupForm.submit();
			}
			else
			{
				document.processTypeSetupForm.processName.disabled = false;
				document.processTypeSetupForm.processType.disabled = false;
				document.processTypeSetupForm.action = "<%=chipTracContext%>/processTypeSetup.do?action=update";
				document.processTypeSetupForm.submit();
			}
		}
	}

	function cancel()
	{
		document.processTypeSetupForm.action = "<%=chipTracContext%>/processList.do";
		document.processTypeSetupForm.submit();
	}

	function addMore()
	{
		document.processTypeSetupForm.processName.disabled = false;
		document.processTypeSetupForm.processType.disabled = false;
		document.processTypeSetupForm.action = "<%=chipTracContext%>/processTypeSetup.do?action=addMore";
		document.processTypeSetupForm.submit();
	}

	function confirm()
	{
		document.processTypeSetupForm.processName.disabled = false;
		document.processTypeSetupForm.processType.disabled = false;
		document.processTypeSetupForm.action = "<%=chipTracContext%>/processTypeSetup.do?action=confirmDelete";
		document.processTypeSetupForm.submit();
	}
	function getSystemParameter()
	{
        document.processTypeSetupForm.action = "<%=chipTracContext%>/processTypeSetup.do?action=parameters";
		document.processTypeSetupForm.submit();
	}

	function validations()
	{
		var processName = document.processTypeSetupForm.processName.value.trim();
		var errors		= "";
		var li = document.getElementById( "message" );
		li.style.visibility = "visible";
		errMsg = "";

		if( document.processTypeSetupForm.processTypeId.value  == -1 )
		{
			var processType = document.processTypeSetupForm.processType.options[document.processTypeSetupForm.processType.selectedIndex].text;
		}

		if( processName == "" )
		{
			errors = errors + "<li>Please enter the Process Name";
			li.innerHTML = errors;
			document.processTypeSetupForm.processName.focus();
			return false;
		}
        if ( document.processTypeSetupForm.processOrder.value == "" )
        {
            errors = errors + "<li>Please enter the Process Order";
			li.innerHTML = errors;
			document.processTypeSetupForm.processOrder.focus();
			return false;

        }
        if (document.processTypeSetupForm.processOrder.value == 0)
        {
            errors = errors + "<li>Process Order value should be greater than zero";
			li.innerHTML = errors;
			document.processTypeSetupForm.processOrder.focus();
			return false;

        }
        if( document.processTypeSetupForm.processTypeId.value  == -1 )
		{
			if( processName != "" )
			{
				document.processTypeSetupForm.processName.value = processName;
				if ( processType == "------Select------" )
				{
					errors = errors + "<li>Please select the Process Type";
					li.innerHTML = errors;
					document.processTypeSetupForm.processType.focus();
					return false;
				}
			}
		}
		if( document.processTypeSetupForm.rowcount.value != null )
		{
			var length = document.processTypeSetupForm.rowcount.value;
			for( var k = 0; k < length; k++ )
			{
				var name  = document.processTypeSetupForm['processParameters['+k+'].paramName'].value.trim();
				var units = document.processTypeSetupForm['processParameters['+k+'].paramUnit'].value;
				var value = document.processTypeSetupForm['processParameters['+k+'].paramVal'].value.trim();
                            document.processTypeSetupForm['processParameters['+k+'].paramVal'].value = value;
				var unitType = null;

				if( typeof ( document.processTypeSetupForm['processParameters['+k+'].paramUnit'].selectedIndex ) == 'undefined' )
				{
					unitType = document.processTypeSetupForm['processParameters['+k+'].paramUnit'].value;
				}
				else
				{
					unitType = 	document.processTypeSetupForm['processParameters['+k+'].paramUnit'].options[document.processTypeSetupForm['processParameters['+k+'].paramUnit'].selectedIndex].text;
				}
				if( name != "" )
				{
					for( var i = 0; i < k; i++ )
					{
                            var lastName = document.processTypeSetupForm['processParameters['+i+'].paramName'].value.trim();
                            lastName = lastName.trim();
                            if( name == lastName )
                            {
                                errors = errors+"<li> parameter name already exists please select another name";
                                li.innerHTML = errors;
                                document.processTypeSetupForm['processParameters['+k+'].paramName'].focus();
                                return false;
                            }
					}

					if( units == "select" )
					{
						errors = errors + "<li>Please select the Units";
						li.innerHTML = errors;
						units = document.processTypeSetupForm['processParameters['+k+'].paramUnit'].focus();
						return false;
					}
				}

				if( units != "select" || value != "" )
				{
					if( name == "" )
					{
						errors = errors + "<li>Please enter the User Parameter Name";
						li.innerHTML = errors;
						document.processTypeSetupForm['processParameters['+k+'].paramName'].focus();
						return false;
					}

					/*if( units != "" && isNaN( value ) )
					{
						errors = errors + "<li>Please select the valid Value";
						li.innerHTML = errors;
						document.processTypeSetupForm['processParameters['+k+'].paramVal'].focus();
						return false;
					}*/

					// Check for valid Units
                    <% if( unitsList != null ){ %>
					    checkParameterValues( k, units, value, name );
                    <% }%>
					if( errMsg.length > 0 )
					{
						errors = errors + errMsg;
						li.innerHTML = errors;
						document.processTypeSetupForm['processParameters['+k+'].paramVal'].focus();
						return false;
					}
				}
			}

			if( errMsg.length == 0 )
			{
				li.innerHTML = errors;
			}
		}
		return true;
	}

	function checkParameterValues( k, unit, value, name )
	{
		var unitArr;
		var baseUom;
		var minValue;
		var maxValue;

		for( var i = 0; i < unitsArray.length; i++ )
		{
			unitArr = unitsArray[ i ];

			if( unitArr[0] == unit )
			{
				break;
			}
			unitArr = null;
		}

		if( unitArr == null )
		{
			return;
		}

		var baseUom = unitArr[1];
		var minValue = unitArr[2];
		var maxValue = unitArr[3];

		if( baseUom == 'DOUBLE' )
		{
			checkFloat( value, name + ' value ', 'N' );
			if( errMsg.length == 0 )
			{
				if( Number( value ) < Number( minValue ) )
				{
					errMsg = "<li>" + name + " value must be greater than " + minValue;
				}
				else if( Number( value ) > Number( maxValue ) )
				{
					errMsg = "<li>" + name + " Value must be less than or equal to "+ maxValue;
				}
			}
			else
			{
				errMsg = "<li>" + errMsg;
			}
		}
		else if ( baseUom == 'INT' )
		{
			checkInteger( value, name + ' value ', 'N' );
			if( errMsg.length == 0 )
			{
				if( parseInt( value ) < parseInt( minValue ) )
				{
					errMsg = "<li>" + name + " value must be greater than " + minValue;
				}
				else if( parseInt( value ) > parseInt( maxValue ) )
				{
					errMsg = "<li>" + name + " Value must be less than or equal to  "+ maxValue;
				}
			}
			else
			{
				errMsg = "<li>" + errMsg;
			}
		}
		else if ( baseUom == 'STRING' )
		{
			if( errMsg.length == 0 )
			{
				if( value.length < minValue  )
				{
					errMsg = "<li>" + name + " value must be of length greater " + minValue;
				}
				else if( value.length > maxValue )
				{
					errMsg = "<li>" + name + " value must be of length less than "+ maxValue;
				}
			}
			else
			{
				errMsg = "<li>" + errMsg;
			}
		}
	}

	function enableDisableValue( k )
	{
		k = k -1;
		if( document.processTypeSetupForm['processParameters['+k+'].paramUnit'].value == "select" )
		{
			//document.processTypeSetupForm['processParameters['+k+'].paramVal'].disabled = true;
            document.processTypeSetupForm['processParameters['+k+'].paramVal'].value = "";
		}
		else
		{
			document.processTypeSetupForm['processParameters['+k+'].paramVal'].disabled = false;
		}
	}

	function enableValue()
	{
		var length = document.processTypeSetupForm.rowcount.value;
		for( var k = 0; k < length; k++ )
		{
			if( document.processTypeSetupForm['processParameters['+k+'].paramUnit'].value == "select" )
			{
				document.processTypeSetupForm['processParameters['+k+'].paramVal'].disabled = true;
			}
			else
			{
				document.processTypeSetupForm['processParameters['+k+'].paramVal'].disabled = false;
			}
		}
	}

    function packageTypeChanged( element )
    {
        errors='';

        var pakageType = element.value;
        if( pakageType == "Add_New_Package" )
        {
            newWindow = window.open ('processTypeSetup.do?action=loadPackageType','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=350 height=350,resizable=no,left=375,top=180');
            newWindow.focus();
        }
    }

    function addNewParameterValue( processType, processParameter, unit )
    {
        errors='';
        unit = unit.replace ( new RegExp( '%', 'g'), '%25' );
        processType = processType.replace ( new RegExp( '%', 'g'), '%25' );
        processType = processType.replace ( new RegExp( '&', 'g'), '%26' );
        processParameter = processParameter.replace ( new RegExp( '%', 'g'), '%25' );
        processParameter = processParameter.replace ( new RegExp( '&', 'g'), '%26' );
        newWindow = window.open ('processTypeSetup.do?action=loadAddMore&processType=' + processType + '&processParameter=' + processParameter + '&paramUnit=' + unit, 'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=350 height=350,resizable=no,left=375,top=180');
        newWindow.focus();
    }

    function refresh()
    {
		document.processTypeSetupForm.processName.disabled = false;
		document.processTypeSetupForm.processType.disabled = false;
		document.processTypeSetupForm.action = "<%=chipTracContext%>/processTypeSetup.do?action=refresh";
        /*var packageIdComboIndex = -1;
        for(var i = 0; i < document.processTypeSetupForm.rowcount.value; i++ )
        {
            if ( document.processTypeSetupForm['processParameters['+i+'].paramName'].value == "Package ID" )
            {
                packageIdComboIndex = i;
                break;
            }
        }

        if ( packageIdComboIndex != -1 )
        {
            document.processTypeSetupForm['processParameters['+packageIdComboIndex+'].paramVal'].value = "";
        }*/
		document.processTypeSetupForm.submit();
    }

</script>

</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<html:form name="processTypeSetupForm" method="post" action="/processTypeSetup.do?action=save" scope="session" type="com.scalar.chiptrack.operations.processtypesetup.forms.ProcessTypeSetupForm" onsubmit="return false;">

<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
	<TR>
		<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
		<!-- Side Navigation start -->
			<%@ include file="/jsp/operations/product_menu.jsp" %>
		<!-- end of the side navigations -->
		</TD>
		<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>

		<TD valign="top" width="100%">
			<!-- from here your body starts -->
			<center><span class="NArialW">Process Type Setup Details</span></center>
			<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height="20">
			<table border="0" align="center" width="100%">
				<tr><td colspan="2" align="right"><font align="right"></font></td></tr>
				<% if( request.getAttribute( "confirm" ) != null && ((String)request.getAttribute( "confirm" )).equalsIgnoreCase( "true" ) ) {%>
				<tr><td colspan="2" align="center" >
				<font class="NArialL"><font color="FF0000"><li> Are you sure, you want to delete this Process ?</font>
                <chiptrack:restrictedLink functionality='<%=Functionality.PROCESS_TYPE_SETUP%>' action='<%=User.USER_ACTION_DELETE%>' href="javascript:confirm();" onmouseover="window.status='Click to Delete Process Information ';return true" onmouseout="window.status='';return true">
                <img border=0 src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" type=image></chiptrack:restrictedLink>&nbsp;&nbsp;
				<a href="javascript:cancel()" onMouseOver="window.status='Click to Cancel and go Back';return true" onMouseOut="window.status='';return true" title="Click here to Cancel and go Back"><IMG border=0 src="<%=chipTracContext%>/jsp/includes/images/cancel.gif"></a>
				</font></td></tr>
				<% } %>
				<tr>
					<td align="center">
						<table border="0" align="center" width="60%" >
							<html:hidden property="processTypeId"/>
                            <logic:equal name="showModifyNotAllowedMessage" value="true">
                                <TR><TD colspan='4' align='left'><font class='NArialS' color='blue'><B><%=Constants.NO_MODIFY_RIGHTS %></B></font></TD></TR>
                            </logic:equal>
                            <logic:equal name="showDeleteNotAllowedMessage" value="true">
                                <TR><TD colspan='4' align='left'><font class='NArialS' color='blue'><B><%=Constants.NO_DELETE_RIGHTS %></B></font></TD></TR>
                            </logic:equal>
							<tr><td colspan=4><chiptrack:info styleClass="NArialL"/></td></tr>
							<tr><td colspan=4><chiptrack:errors styleClass="NArialL"/></td></tr>
							<tr>
								<td colspan=4 class="NArialL"><font align=left color="FF0000" id=message></font></td>
							</tr>
							<tr>
                                <td colspan=1>&nbsp;</td>
                                <td width="25%" class="NArialL">Process Name<font color="FF0000"><b>*</b></font></td>
								<td width="20%">
									<logic:equal name="processTypeSetupForm" property="processTypeId" value="-1">
										<html:text property="processName" maxlength="50" styleClass="txfield"/>
									</logic:equal>
									<logic:notEqual name="processTypeSetupForm" property="processTypeId" value="-1">
										<html:text property="processName" styleClass="txfield" disabled="true"/>
									</logic:notEqual>
								</td>
                                <td colspan=1>&nbsp;</td>
                            </tr>
							<tr>
                                <td colspan=1>&nbsp;</td>
                                <td class="NArialL">Process Type<font color="FF0000"><b>*</b></font></td>
								<td>
									<logic:equal name="processTypeSetupForm" property="processTypeId" value="-1">
										<html:select property="processType" styleClass="txfield" onchange="javascript:getSystemParameter();">
											<html:option value="">------Select------</html:option>
											<html:options collection="processList" property="value" labelProperty="label"/>
										</html:select>
									</logic:equal>
									<logic:notEqual name="processTypeSetupForm" property="processTypeId" value="-1">
										<html:text property="processType" styleClass="txfield" disabled="true"/>
									</logic:notEqual>
								</td>
                                <td colspan=1>&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan=1>&nbsp;</td>
                                <td class="NArialL">Process Order#<font color="FF0000"><b>*</b></font></td>
                                <td><html:text property="processOrder" maxlength="3" styleClass="valuetxfield" onkeypress="javascript:allowInteger()"/></td>
                                <td colspan=1>&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan=1>&nbsp;</td>
                                <td align="center" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;<html:radio property="inventoryType" value="WIP"/>WIP</td>
                                <td align="center" class="NArialL"><html:radio property="inventoryType" value="inventory"/>Inventory</td>
                                <td colspan=1>&nbsp;</td>
                            </tr>
                        </table>
					</td>
				</tr>
				<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
				<tr>
					<td>
						<table border="0" width="80%" align="center">
							<logic:equal name="showSystemParameters" value="true" >
							<tr><td colspan="4"><font class="NArialL">System Parameters</font></td></tr>
							<tr bgcolor="#993333">
								<td align="center"><font class="NArialL"><font color="#FFFFFF">Name</font></font></td>
								<td align="center"><font class="NArialL"><font color="#FFFFFF">Units</font></font></td>
								<td align="center"><font class="NArialL"><font color="#FFFFFF">Value</font></font></td>
							</tr>
							</logic:equal>
							<nested:iterate property="processParameters" id="processParameter" type="com.scalar.chiptrack.operations.processtypesetup.ProcessParameters" scope="session" >
							<nested:equal property="sysParam" value="true">
							<% rowcount++; %>
								<tr>
									<nested:hidden property="processParameterId"/>
									<td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
										<nested:text property="paramName" styleClass="txfield" disabled="true" />
									</td>
									<td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
										<nested:text property="paramUnit" styleClass="txfield" disabled="true" />
									</td>
									<td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
										<%
											if( "view".equalsIgnoreCase( actionVal ) )
											{
										%>
										<nested:text property="paramVal" styleClass="txfield" disabled="true" />
										<%
											}
											else
											{
                                                String processType = processTypeForm.getProcessType();
                                                String parameterName = ((ProcessParameters)processParameter).getParamName();
                                                HashMap comboMap    = ( HashMap )request.getAttribute ( "comboMap" );
                                                if ( parameterName != null && comboMap != null && comboMap.containsKey( parameterName.trim() ) )
                                                {
                                                    //String jsMethod = "packageTypeChanged( this )";
                                                    pageContext.setAttribute ( parameterName.trim(), comboMap.get ( parameterName.trim() ) );
                                        %>          <%--<logic:equal name="processTypeSetupForm" property="processType" value="Assembly">--%>
                                                    <nested:select property="paramVal" styleClass="txfield" >
	                                                    <html:option value="" >-----  Select  -----</html:option>
	                                                    <html:options collection="<%=parameterName.trim()%>"  property="label" labelProperty="value" />&nbsp;
                                                        <%--<html:option value="Add_New">--AddNew--</html:option>--%>
                                                    </nested:select>
                                                    <%--</logic:equal>--%>
                                        <%
                                                }
                                                else
                                                {
										%>
            										<nested:text property="paramVal" styleClass="txfield"/>
										<%      }
                                                String jsFunction = "javascript:addNewParameterValue('"+processTypeForm.getProcessType()+"','"+((ProcessParameters)processParameter).getParamName()+"','"+((ProcessParameters)processParameter).getParamUnit()+"')";
                                        %>
                                                <chiptrack:restrictedLink functionality='<%=Functionality.PROCESS_TYPE_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href="<%=jsFunction%>" onmouseover="window.status='Click here to add new parameter value';return true" onmouseout="window.status='';return true">
                                                <img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center title="Click here to add new parameter value"></chiptrack:restrictedLink>
                                        <%
											}
										%>
									</td>
								</tr>
								</nested:equal>
							</nested:iterate>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table border="0" width="80%" align="center">
							<logic:equal name="showUserParameters" value="true" >
							<tr><td colspan="4"><font class="NArialL">User Parameters</font></td></tr>
							<tr bgcolor="#993333">
								<td align="center"><font class="NArialL"><font color="#FFFFFF">Delete</font></font></td>
								<td align="center"><font class="NArialL"><font color="#FFFFFF">Name</font></font></td>
								<td align="center"><font class="NArialL"><font color="#FFFFFF">Units</font></font></td>
								<td align="center"><font class="NArialL"><font color="#FFFFFF">Value</font></font></td>
							</tr>
							</logic:equal>
							<nested:iterate property="processParameters"  type="com.scalar.chiptrack.operations.processtypesetup.ProcessParameters" scope="session" >
							<nested:notEqual property="sysParam" value="true">
							<% rowcount++; %>
							<tr>
								<nested:hidden property="processParameterId"/>
                                <nested:hidden property="sysParam"/>
                                <nested:hidden property="isEditable"/>
                                 <nested:notEqual property="processParameterId" value="-1">
                                     <nested:equal property="sysParam" value="true" >
                                        <td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
                                         <nested:checkbox property="deleteParam" disabled="true"/>
                                        </td>
                                     </nested:equal>
                                    <nested:equal property="sysParam" value="false" >
                                        <td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
                                        <logic:equal name="processTypeSetupForm" property="action" value="view">
                                            <nested:checkbox property="deleteParam" disabled="true" />
                                        </logic:equal>
                                        <logic:notEqual name="processTypeSetupForm" property="action" value="view">
                                            <nested:checkbox property="deleteParam" />
                                        </logic:notEqual>
                                        </td>
                                    </nested:equal>
                                 </nested:notEqual>

								<nested:equal property="processParameterId" value="-1">
								<td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
									<nested:checkbox property="deleteParam" disabled="true"/>
								</td>
								</nested:equal>
								<td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
									<nested:equal property="processParameterId" value="-1">
										<nested:text property="paramName" styleClass="txfield" maxlength ="50" />
									</nested:equal>
									<nested:notEqual property="processParameterId" value="-1">
                                        <logic:equal name="processTypeSetupForm" property="action" value="view">
                                            <nested:text property="paramName" styleClass="txfield" disabled="true" />
                                        </logic:equal>
                                        <logic:notEqual name="processTypeSetupForm" property="action" value="view">
                                            <nested:equal property="isEditable" value="true">
										        <nested:text property="paramName" styleClass="txfield" maxlength="50" />
                                            </nested:equal>
                                            <nested:notEqual property="isEditable" value="true">
                                                <nested:text property="paramName" styleClass="txfield" disabled="true" />
                                            </nested:notEqual>
                                        </logic:notEqual>
									</nested:notEqual>
								</td>
								<td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
									<nested:equal property="processParameterId" value="-1" >
										<% String str = "javascript:enableDisableValue(" + rowcount + ")"; %>
										<nested:select property="paramUnit" styleClass="txfield" onchange="<%=str%>">
											<html:option value="select">--Select Units--</html:option>
											<html:options collection="units" property="uom" labelProperty="uom" />
										</nested:select>
									</nested:equal>
									<nested:notEqual property="processParameterId" value="-1">
                                        <logic:equal name="processTypeSetupForm" property="action" value="view">
                                            <nested:text property="paramUnit" styleClass="txfield" disabled="true" />
                                        </logic:equal>
                                        <logic:notEqual name="processTypeSetupForm" property="action" value="view">
                                            <nested:equal property="isEditable" value="true">
                                                <% String str = "javascript:enableDisableValue(" + rowcount + ")"; %>
                                                <nested:select property="paramUnit" styleClass="txfield" onchange="<%=str%>">
                                                    <html:option value="select">--Select Units--</html:option>
                                                    <html:options collection="units" property="uom" labelProperty="uom" />
                                                </nested:select>
                                            </nested:equal>
                                            <nested:notEqual property="isEditable" value="true">
                                                <nested:text property="paramUnit" styleClass="txfield" disabled="true" />
                                            </nested:notEqual>
                                        </logic:notEqual>
									</nested:notEqual>
								</td>
								<td align="center" <%if(rowcount%2==0){%> bgcolor='#DEE1E2'<% } else {%> bgcolor='#FFFFEE'<%}%> >
									<logic:notEqual name="processTypeSetupForm" property="action" value="view">
										<nested:text property="paramVal" styleClass="txfield" maxlength ="200" />
									</logic:notEqual>
									<logic:equal name="processTypeSetupForm" property="action" value="view">
										<nested:text property="paramVal" styleClass="txfield" disabled="true"/>
									</logic:equal>
								</td>
							</tr>
							</nested:notEqual>
							</nested:iterate>
							<input type="hidden" name="rowcount" value="<%=rowcount%>">
						</table>
					</td>
				</tr>
				<tr><td>&nbsp;</td></tr>
				<tr>
					<td>
						<table border="0" width="80%" align="right">
							<tr>
								<td colspan="3" align="right">
									<logic:notEqual name="processTypeSetupForm" property="action" value="view">
										<logic:notEqual name="processTypeSetupForm" property="processType" value="">
                                            <chiptrack:restrictedLink functionality='<%=Functionality.PROCESS_TYPE_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:addMore()" onmouseover="window.status='Click to Add more Parameters';return true" onmouseout="window.status='';return true" onmouseout="window.status='';return true">
											    <img src="<%=chipTracContext%>/jsp/includes/images/addmore.gif" type="image" border="0" title="Click here to Add more Parameters">
                                            </chiptrack:restrictedLink>
										</logic:notEqual>
										<script language="java">
											enableValue();
										</script>
									</logic:notEqual>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%">
							<TR align="center" border="0">
								<TD bgColor="" align="center">
								<logic:notEqual name="processTypeSetupForm" property="processType" value="">
									<logic:notEqual name="processTypeSetupForm" property="action" value="view">
                                        <chiptrack:restrictedLink functionality='<%=Functionality.PROCESS_TYPE_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submit()" onmouseover="window.status='Click to Save Process Information ';return true" onmouseout="window.status='';return true">
                                        <img border=0 src="<%=chipTracContext%>/jsp/includes/images/submit.gif" type=image></chiptrack:restrictedLink>
										&nbsp;&nbsp;
										<a href="javascript:document.processTypeSetupForm.reset()" onMouseOver="window.status='Click to Reset the Process Information';return true" onMouseOut="window.status='';return true" title="Click here to Reset Process Information"><IMG border=0 src="<%=chipTracContext%>/jsp/includes/images/reset.gif"></a>
										&nbsp;&nbsp;
									</logic:notEqual>
									<% if( request.getAttribute( "confirm" ) == null || (!((String)request.getAttribute( "confirm" )).equalsIgnoreCase( "true" )) ) {%>
									<a href="javascript:cancel()" onMouseOver="window.status='Click to Cancel and go Back';return true" onMouseOut="window.status='';return true" title="Click here to Cancel and go Back"><IMG border=0 src="<%=chipTracContext%>/jsp/includes/images/cancel.gif"></a>
									<% } %>
								</logic:notEqual>
								</TD>
							</TR>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</html:form>
</BODY>
</HTML>